package com.hy.controller;

import com.hy.Result.ResponseResult;
import com.hy.pojeVo.QueryParam;
import com.hy.pojo.vaccine.VaccinationAppointment;
import com.hy.service.VaccinationAppointmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/api/vaccinationAppointment")
public class VaccinationAppointmentController {

    @Autowired
    private VaccinationAppointmentService appointmentService;
    /**
     * 删除预约
     */
    @DeleteMapping("/deleteAppointment")
    public ResponseResult deleteAppointment(@RequestParam("id") Integer id) {
        return appointmentService.deleteAppointment(id);
    }

    /**
     * 通过用户ID查询预约详细信息
     */
    @GetMapping("/details/user")
    public ResponseResult getAppointmentDetailsByUserId(@RequestParam("userId") Long userId) {
        return appointmentService.getAppointmentDetailsByUserId(userId);
    }
    /**
     * 通过用户ID查询预约信息
     */
    @GetMapping("/user")
    public ResponseResult getAppointmentsByUserId(@RequestParam("userId") Long userId) {
        return appointmentService.getAppointmentsByUserId(userId);
    }

    /**
     * 创建预约
     */
    @PostMapping("/create")
    public ResponseResult createAppointment(@RequestBody VaccinationAppointment appointment) {
        return appointmentService.createAppointment(appointment);
    }

    /**
     * 更新预约
     */
    @PutMapping("/updateAppointment")
    public ResponseResult updateAppointment(@RequestBody VaccinationAppointment appointment) {
        return appointmentService.updateAppointment(appointment);
    }


    /**
     * 分页查询预约
     */
    @PostMapping("/page")
    public ResponseResult searchByNamePage(@RequestBody QueryParam queryParam) {
        return appointmentService.searchByKeyword(queryParam);
    }



}
